<ResourceDictionary 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:gui="clr-namespace:DentalGUIHelper;assembly=DentalConfig">
    <BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"/>

     <Style x:Key="DentalToolWindowHelpButtonStyle" TargetType="{x:Type gui:OnlineHelpButton}">
        <Setter Property="Background" Value="{DynamicResource TransparentWhiteBrush}" />
        <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" />
        <Setter Property="HorizontalContentAlignment" Value="Center" />
        <Setter Property="VerticalContentAlignment" Value="Center" />
        
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type gui:OnlineHelpButton}">
                    <Grid x:Name="grid" Background="{TemplateBinding Background}">
                        <ContentPresenter x:Name="contentPresenter"
                                          HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                          Margin="{TemplateBinding Padding}"
                                          VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                                          SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
                                          RecognizesAccessKey="True"
                                          Opacity="0.75" />
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter TargetName="contentPresenter" Property="Opacity" Value="1" />
                            <Setter TargetName="grid" Property="Background" Value="{DynamicResource SemiTransparentWhiteBrush}" />
                        </Trigger>
                        <Trigger Property="IsMouseOver" Value="False">
                            <Setter TargetName="contentPresenter" Property="Opacity" Value=".5" />
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="false">
                            <Setter Property="Visibility" Value="Collapsed" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

	
    <!-- DentalToolWindowBase Style with own title bar -->
    <Style TargetType="{x:Type gui:DentalToolWindowBase}">
        <Setter Property="Background" Value="{DynamicResource ToolWindowBackgroundBrush}" />
        <Setter Property="BorderThickness" Value="1"/>
        <Setter Property="BorderBrush" Value="{DynamicResource BrandBrush1}" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type gui:DentalToolWindowBase}">
                    <Border BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}">
                        <Grid Background="{TemplateBinding Background}">
                            <AdornerDecorator>
                                <DockPanel Background="{TemplateBinding Background}">
                                    <!-- Title bar -->
                                    <DockPanel x:Name="PART_TitleBar" DockPanel.Dock="Top" Background="{DynamicResource ToolWindowTitleBrush}"
                                           Height="{Binding TitlebarHeight, Mode=OneWay, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type gui:DentalToolWindowBase}}}"
                                           Visibility="{TemplateBinding ShowTitleBar, Converter={StaticResource BooleanToVisibilityConverter}}">										   										
                                        
										<!-- Close Button -->
                                        <Button x:Name="PART_Close"
                                            DockPanel.Dock="Right"
                                            IsTabStop="False"
                                            Width="20"
                                            Height="20"
                                            VerticalAlignment="Center"
                                            Style="{DynamicResource IronicallyNamedChromelessButtonStyle}"
                                            Foreground="White">
                                            <Path Data="F1M0,0L2,0 5,3 8,0 10,0 6,4 10,8 8,8 5,5 2,8 0,8 4,4 0,0z" SnapsToDevicePixels="True" Fill="White"/>
                                        </Button>
										

										<!-- Help Button -->
										
       					<gui:OnlineHelpButton x:Name="PART_OnlineHelp"
       						DockPanel.Dock="Right"
       						IsTabStop="False"
       						Width="20"
       						Height="20"
       						VerticalAlignment="Center"
       						Style="{DynamicResource DentalToolWindowHelpButtonStyle}"
       						Visibility="Collapsed"
       						Foreground="White">
       						<Path Data="F1M0,0L2,0 5,3 8,0 10,0 6,4 10,8 8,8 5,5 2,8 0,8 4,4 0,0z" SnapsToDevicePixels="True" Fill="White"/>
       					</gui:OnlineHelpButton>
                                        <!-- Window Title -->
										<Canvas>
											<Grid Height="{Binding Parent.ActualHeight, Mode=OneWay, RelativeSource={RelativeSource Self}}"
                                                  Width="{Binding Parent.ActualWidth, Mode=OneWay, RelativeSource={RelativeSource Self}}">
												<TextBlock Text="{TemplateBinding Title}"
														   TextTrimming="CharacterEllipsis"
														   VerticalAlignment="Center"
														   Margin="8 -1 0 0"
														   FontSize="16"
														   Foreground="White"/>
											</Grid>
										</Canvas>	
                                    </DockPanel>

                                    <!-- Window content -->
                                    <ContentPresenter Grid.Row="1"/>
                                </DockPanel>
                            </AdornerDecorator>
                        </Grid>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

</ResourceDictionary>